package org.springblade.test.http;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.dataformat.xml.XmlMapper;
import com.google.common.collect.Lists;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.springblade.modules.digitalization.wrapper.UserDaRs;
import org.springblade.modules.digitalization.wrapper.UserInfoRs;
import org.springblade.modules.digitalization.wrapper.UserMenuRs;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

public class XmlRsTe {
	public static void main(String[] args) throws JsonProcessingException {
		UserDaRs userDaRs = new UserDaRs();
		UserInfoRs userInfoRs = new UserInfoRs();
		userInfoRs.setUserName("李陆军");
		userInfoRs.setSex("男");
		userInfoRs.setBirthDay("");
		UserMenuRs userMenuRs = new UserMenuRs();
		userMenuRs.setCaiLiaoName("路里标");
		userMenuRs.setCreateAt(new Date());
		List<String> ys = Lists.newArrayList();
		List<String> hd = Lists.newArrayList();
		ys.add("1.jgp");
		ys.add("2.jgp");
		ys.add("3.jgp");
		ys.add("4.jgp");
		hd.add("1.jgp");
		hd.add("2.jgp");
		hd.add("3.jgp");
		hd.add("4.jgp");


		userMenuRs.setOrgImgs(ys);
		userMenuRs.setHdImgs(hd);
		userDaRs.setUserInfo(userInfoRs);
		List<UserMenuRs> userMenuRs1 = Lists.newArrayList();
		userMenuRs1.add(userMenuRs);
		userDaRs.setMenus(userMenuRs1);
		ObjectMapper mapper = new XmlMapper();
		mapper.enable(SerializationFeature.INDENT_OUTPUT);
		String s = mapper.writeValueAsString(userDaRs);
		s="<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"+s;
		System.out.println(s);

	}
}
